package com.hnichr.ump.business.service.impl;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hnichr.ump.common.doc.entity.Group;
import com.hnichr.ump.common.doc.entity.GroupUser;
import com.hnichr.ump.common.doc.service.GroupService;
import com.mxpioframework.jpa.JpaUtil;
import com.mxpioframework.jpa.query.Criteria;
import com.mxpioframework.system.service.impl.BaseServiceImpl;

@Service
public class GroupServiceImpl extends BaseServiceImpl<Group> implements GroupService {

	@Override
	@Transactional(readOnly = true)
	public Page<Group> listPageWithUsers(Criteria criteria, Pageable pageAble) {
		return JpaUtil.linq(Group.class).collect("groupId", GroupUser.class, "id").where(criteria).paging(pageAble);
	}

}
